import ajax from "./ajax";
import mockAjax from "./mockAjax";
export const reqCategoryListData = () =>
  ajax.get("/product/getBaseCategoryList");
export const reqGetBannerListData = () => mockAjax.get("/bannerList");
export const reqGetFloorsListData = ()=> mockAjax.get("/floorsList");
// 4. 获取搜索数据   这个不是List 因为不是数组 是一个对象
export const reqSearchGoodsInfoData = (searchParams) => ajax.post('/list', searchParams);
export const reqGoodDetailInfoData = (id)=> ajax.get('/item/'+id)

export const reqAddOrUpdateCart = (skuId,skuNum)=>ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)
export const reqShopCartListData = ()=>ajax.get('/cart/cartList')
export const reqChangeShopCartInfoState = (skuID,isChecked)=>ajax.get(`/cart/checkCart/${skuID}/${isChecked}`)
export const reqChangeAllCartState = (isChecked, skuIdList) => ajax.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)
export const reqDelOneShopCartInfo = (skuId) => ajax.delete(`/cart/deleteCart/${skuId}`)
// export const reqDelSelectedShopCartInfo = (selectedObj)=>ajax.post(`/cart/batchDeleteCart`,selectedObj)
export const reqDelSelectedShopCartInfo = skuIdList => ajax.post('/cart/batchDeleteCart', skuIdList);
// 12. 获取trade页面中的数据
export const reqGetTradeListData = ()=> ajax.get('/order/auth/trade')
// 13. 获取手机验证码
export const reqGetPhoneVerifyCode = (phone) =>
  ajax.get(`/user/passport/sendCode/${phone}`);
// 14. 注册用户
export const reqUserRegister = (user) =>
  ajax.post(`/user/passport/register`, user);

// 15. 账户登陆
export const reqUserLogin = (user) => ajax.post("/user/passport/login", user);
export const reqLogout = () => ajax.get('/user/passport/logout')
// 17. 获取trade页面中的地址
export const reqGetUserAddressListData =()=> ajax.get('/user/userAddress/auth/findUserAddressList')
// 18. 提交商品到付款页面
export const reqSumitOrder = (tradeNo, params) => ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, params)
// 19. 获取订单支付信息 也就是支付链接 用支付链接再结合插件实现的二维码图片
export const reqGetOrderPayment = (orderId)=> ajax.get(`/payment/weixin/createNative/${orderId}`)
// 20. 查询订单支付状态 
export const reqQueryPayStatus = orderId => ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)
// 21. 获取订单中心的数据
export const reqGetCenterListData = (page,limit)=> ajax.get(`/order/auth/${page}/${limit}`)